package com.gang.music.system.controller;

import com.gang.music.common.AjaxResult;

public class BaseController {
	
	public AjaxResult success() {
		return new AjaxResult();
	}
	
	public AjaxResult success(Object data) {
		return new AjaxResult().success(data);
	}
	
	public AjaxResult error(String message) {
		return new AjaxResult().addError(message);
	}
	
	public AjaxResult error() {
		
		return new AjaxResult().addError(null);
	}
	
	/*@ResponseBody
	@ExceptionHandler(Exception.class)
	public Object exceptionHandler(Exception ex, HttpServletResponse response, HttpServletRequest request) {
		ex.printStackTrace();
		if (ex instanceof MaxUploadSizeExceededException) {
			long maxSize = ((MaxUploadSizeExceededException)ex).getMaxUploadSize();
			return error("文件不能超过" +maxSize / 1024 / 1024 + "m");
		}else if(ex instanceof NoPermissionException) {
			return error("你没有该操作的权限,请联系管理员");
		}
		return null;
	}*/
}
